package com.awifi.config;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @description: ToDo
 * @author: marin
 * @time: 2020/7/15 8:59
 */

@Component
@Aspect
public class Audience {

    @Pointcut("execution(* com.awifi.service.impl.*.*(..))")
    public void expressRes(){}

    @Around("expressRes()")
    public void strong(ProceedingJoinPoint point){
        try {
            System.out.println("AOP增强方法执行前-----------");
            Object[] args = point.getArgs();
            Object result = point.proceed(args);
            System.out.println("AOP增强方法执行后------------");
        } catch (Throwable e) {
            e.printStackTrace();
            System.out.println("异常方法执行++++++++++");
        }finally {
            System.out.println("最终通知执行++++++++++");
        }
    }
}
